// 平台属性管理模块的接口
import request from '@/utils/bradn-request'

// 获取一级分类 /admin/product/getCategory1 get 
export const reqCategory1List = () => request.get('/admin/product/getCategory1')

// 获取二级分类 /admin/product/getCategory2/{category1Id} get
export const reqCategory2List = (category1Id) => request.get(`/admin/product/getCategory2/${category1Id}`)

// 获取三级分类 /admin/product/getCategory3/{category2Id} get
export const reqCategory3List = (category2Id) => request.get(`/admin/product/getCategory3/${category2Id}`)

// 获取平台属性管理数据  /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id} get
export const reqAttrInfoList = (category1Id, category2Id, category3Id) => request.get(`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`)

// 添加|修改属性 /admin/product/saveAttrInfo post
/** data:
 * {
    "attrName": "string",
        "attrValueList": [
            {
                "attrId": 0,
                "id": 0,
                "valueName": "string"
            }
        ],
            "categoryId": 0,
                "categoryLevel": 0,
                    "id": 0
}
 */
export const reqAddOrUpdateAttrInfo = (data) => request({
    url: '/admin/product/saveAttrInfo',
    method: 'post',
    data
})
